# Markup impact coefficients by Sampi et al. (2021)

The method requires a panel of firms, including information about their labor share (proportion of wage bill to total firm value added), total sales (nominal), nominal stock of capital, number of employees and an assumption regarding the type of production function (Cobb Douglas or CES). The `Z1_markups_sampi_prep.do` file in `all_codes` prepares all data that goes into Sampi et al.'s MATLAB method. 

The following are how we compute the different columns of Table C1 using the Sampi et al. method. We always show only the markup impact coefficient of interest and its associated standard deviation via bootstrapping (500 random subsamples).

**Global** (used for column 3 of Table C1. File: Table_C1_b_pooled): This is the standard Sampi et al. method (it uses the `like.m` and `standardizeT_new.m` MATLAB functions from Sampi et al). It receives a panel of firm information (broken down into a firm-year matrix for each variable), along with a dummy matrix indicating the period in which the event happened, and it produces a single markup impact coefficient (without horizon). 

**Global_never** (used for column 4 of Table C1. File: Table_C1_c_pooled): This alternative modifies the previous "Global" method in that we substitute never treated as controls with eventually treated (information post event for controls is recoded as NaN so that it is not taken into account).  

**Rel_med_aleat** (used for column 3 of Table C1. File: Table_C1_b_yearly): This alternative modifies the standard Sampi method to give one markup impact coefficient for each -4:4 relative time horizon (coefficient for t=-1 is not given since this time is used as the base or point of reference). To do so, the year time panel is transformed into a relative time panel that goes from t=-4 to t=4. For treated firms it is easy to compute the relative time to event. For control units, which do not have events, we center $t=0$ in a random year available for each firm. Then, for each horizon, we redefine the relative time panel as the observations that go from $t=-1$ to horizon "h". For "h<0", we redefine the relative time panel as the observations that go from negative horizon "h" to $t=-1$. Similar to previous method "global_rel", since the Sampi method is based on an impact event (dummy change from 0 to 1), for the cases in which the horizon is negative "h<0", the method doesn't compute an impact because there are no 1's left in the dummy matrix. Therefore, for those cases, the dummy variable in $t=-1$ for treated firms is recoded as 1 so that the method can calculate the markup impact from $t=-4,-3,-2$ to $t=-1$. 

**Rel_med_never_aleat** (used for column 4 of Table C1. File:  Table_C1_c_yearly): This alternative modifies the previous "Rel_med_aleat" method in that we substitute never treated as controls with eventually treated (information post event for controls is recoded as NaN so that it is not taken into account). For control units, which do not have events, we center $t=0$ in a random (pre event) year available for each firm.  

### Code structure

The following are the codes that implement all previous methods and results (in sequence to run). They are all located in: `all_codes`. Note that the code `Z2_markups_sampi_estimation.m` is a single code that appends (in order) all MATLAB codes used. This sequence uses three initial inputs: `like.m` and `standardizeT_new.m` MATLAB functions from Sampi et al, and our `analysis_data.dta`

1. `Z1_markups_sampi_prep.do`: prepares firms' yearly data (labor share, total sales, nominal stock of capital and number of employees) that enters as input in Sampi's et al. (2021) MATLAB code. It produces the inputs: `matlab_input_${var}_${method}.csv`. 
2. `markups_sampi_estimation_global.m`: implements Sampi's et al. (2021) original method. It produces one markup impact coefficient after event and its standard deviation. It produces the output: `Table_C1_b_pooled.csv`. 
3. `markups_sampi_estimation_global_never.m`: implements Sampi's et al. (2021) method, however, it excludes never-suppliers as controls and uses only eventually-treated. It produces the output: `Table_C1_c_pooled.csv`. 
4. `markups_sampi_estimation_rel_med_aleat.m`: implements Sampi's et al. (2021) method modified to separate the markup impact coefficient by event-relative time horizon (years before and after event). It produces eight coefficients (one by relative horizon and excluding relative time $t=-1$ since it is used as the reference base) and their standard deviation. It produces the output: `Table_C1_b_yearly.csv`. 
5. `markups_sampi_estimation_rel_med_never_aleat.m`: implements Sampi's et al. (2021) method modified to separate the markup impact coefficient by event-relative time horizon. However, it excludes never-suppliers as controls and uses only eventually-treated. It produces the output: `Table_C1_c_yearly.csv`. 







